import request from '@/utils/request'

export function Get(id, args) {
  return request({
    url: `/crm/api/productionorder/${id || ''}${args && ('?' + args) || ''}`,
    method: 'get'
  })
}

export function Post(data) {
  return request({
    url: '/crm/api/productionorder/',
    headers: { 'content-type': 'application/json' },
    method: 'post',
    data: data
  })
}

export function Put(id, data) {
  return request({
    url: `/crm/api/productionorder/${id || ''}`,
    headers: { 'content-type': 'application/json' },
    method: 'put',
    data: JSON.stringify(data)
  })
}

export function Delete(id) {
  return request({
    url: `/crm/api/productionorder/${id || ''}`,
    method: 'delete'
  })
}

// 切换参数确认状态（管理员使用，需要登录）
export function ToggleConfirmStatus(paramId, confirmStatus) {
  return request({
    url: `/crm/api/toggleparameterconfirmation/${paramId}/`,
    method: 'post',
    headers: { 'content-type': 'application/json' },
    data: {
      confirm_status: confirmStatus
    }
  })
}

// 批量重置所有确认状态为未确认
export function ResetAllConfirmations(productionOrderId) {
  return request({
    url: `/crm/api/resetallconfirmations/${productionOrderId}/`,
    method: 'post'
  })
}

